<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>箭头函数+对象解构</title>
  </head>
  <script type="text/javascript">
    const monster = {
      name: "红孩儿",
      age: 1000,
      skill: ['红缨枪', '三味真火']
    }

    //在方法形参取出monster对象的skill属性
    //传统
    function f1(monster) {
      console.log("skill=", monster.skill);
    }
    f1(monster);

    //ES6风格
    /*
      f2传入对象monster，f2形参{skill}
      根据ES6对象解构特性，会把monster对象的skill属性赋给形参skill
     */
    let f2 = ({skill}) => {
      console.log("skill=", skill);
    }
    f2(monster);
  </script>
  <body>

  </body>
</html>